package com.yupi.yupicturebackend.model.dto.picture;

/**
 * 社交平台枚举
 *
 * @author yupi
 */
public enum SocialPlatform {
    
    /**
     * 微博
     */
    WEIBO("weibo", "新浪微博", "https://weibo.com"),
    
    /**
     * 微信
     */
    WECHAT("wechat", "微信", "https://weixin.qq.com"),
    
    /**
     * QQ
     */
    QQ("qq", "QQ", "https://qq.com"),
    
    /**
     * Twitter
     */
    TWITTER("twitter", "Twitter", "https://twitter.com"),
    
    /**
     * Facebook
     */
    FACEBOOK("facebook", "Facebook", "https://facebook.com"),
    
    /**
     * LinkedIn
     */
    LINKEDIN("linkedin", "LinkedIn", "https://linkedin.com"),
    
    /**
     * Instagram
     */
    INSTAGRAM("instagram", "Instagram", "https://instagram.com"),
    
    /**
     * TikTok
     */
    TIKTOK("tiktok", "TikTok", "https://tiktok.com"),
    
    /**
     * 小红书
     */
    XIAOHONGSHU("xiaohongshu", "小红书", "https://xiaohongshu.com"),
    
    /**
     * 知乎
     */
    ZHIHU("zhihu", "知乎", "https://zhihu.com"),
    
    /**
     * 豆瓣
     */
    DOUBAN("douban", "豆瓣", "https://douban.com"),
    
    /**
     * 贴吧
     */
    TIEBA("tieba", "百度贴吧", "https://tieba.baidu.com");

    private final String code;
    private final String name;
    private final String url;

    SocialPlatform(String code, String name, String url) {
        this.code = code;
        this.name = name;
        this.url = url;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public String getUrl() {
        return url;
    }

    /**
     * 根据代码获取平台
     */
    public static SocialPlatform getByCode(String code) {
        for (SocialPlatform platform : values()) {
            if (platform.getCode().equals(code)) {
                return platform;
            }
        }
        return null;
    }
}
